﻿//********************************************************************
// 
//  file:  frmDownloadLogs.cs
// 
//  (C) Copyright 2010, Diomede Corporation
//  All rights reserved
// 
//  Use, modification, and distribution is subject to   
//  the New BSD License (See accompanying file license.txt).
// 
//********************************************************************

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Diomede.SDK;

namespace Diomede.Explorer
{
    public partial class frmDownloadLogs : Form
    {
        public frmDownloadLogs()
        {
            InitializeComponent();
        }

        public ISession Session { get; set; }

        public frmDownloadLogs(ISession session)
        {
            InitializeComponent();
            Session = session;
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            ILogsManagement l = Session as ILogsManagement;
            ISearchDownloadLogsExecResult result = l.SearchDownloadLogs(null, new DateTime( dtFrom.Value.Year,dtFrom.Value.Month,dtFrom.Value.Day,0,0,0),
                new DateTime(dtTo.Value.Year, dtTo.Value.Month, dtTo.Value.Day, 23, 59, 59), "", "", 0, 100);
            if (result.Status == Diomede.SDK.Enums.ExecutionResults.Success)
            {
                dataGrid.DataSource = result.Logs;
                dataGrid.Columns[0].Visible = false;

            }
            else
            {
                MessageBox.Show(this, result.Message, "Error");
            }
        }
    }
}
